from django.db import models
from apps.utils.db import table_prefix, CoreModel
from apps.system.models.user import User


class Role(CoreModel):
    """
    用户组
    """
    name = models.CharField(verbose_name='组名称', help_text='组名称', max_length=100)
    permissions = models.CharField(verbose_name='权限', help_text='权限', default='', max_length=255, blank=True)
    users = models.ManyToManyField(User, verbose_name='用户', blank=True)
    is_active = models.BooleanField(verbose_name='是否禁用', default=True)
    desc = models.CharField(verbose_name='描述', help_text='描述', default='', max_length=255, blank=True)

    class Meta:
        db_table = table_prefix + 'custom_role'
        verbose_name = '用户组表'
        verbose_name_plural = verbose_name
